#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string s;
int n;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		cin >> s;
		for (int i = 0; i < n; i++) {
			if (s[i] >= 'A' && s[i] <= 'Z') {
				s[i] += 32;
			}
		}
		s.erase(unique(s.begin(), s.end()), s.end());
		if (s == "meow")puts("YES");
		else puts("NO");
	}
	return 0;
}